import { GetButtonPermission } from '@/api/role';
// 定义一个混入对象
var MyMixin = {
    data() {
        return { menuUrl: this.$route.path, hasQuery: false, hasAdd: false, hasUpdate: false, hasDelete: false }
    },
    async created() {
        await this.GetButtonPermission();
        console.log(this.menuUrl, this.hasQuery, this.hasAdd, this.hasUpdate, this.hasDelete)
    },
    methods: {
        async GetButtonPermission() {
            if (this.menuUrl == '/login') {
                return;
            }
            var res = await GetButtonPermission({ url: this.menuUrl });
            this.hasQuery = res.data.hasQuery;
            this.hasAdd = res.data.hasAdd;
            this.hasUpdate = res.data.hasUpdate;
            this.hasDelete = res.data.hasDelete;
        }
    }
}
export default MyMixin;